<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\PaymentRequest;
use Hash;
class PaymentRequestController extends Controller
{
    public function store(Request $request)
    {
		
		return $request->input(); 
 		
    }

    public function save(Request $request)
    { 
    	if($request->id_number === null){
    		return response()->json(null,404);
    	}
    	$data = PaymentRequest::create([
    		'id'=>Hash::make(time()),
    		'name'=>$request->name,
    		'phone'=>$request->phone,
    		'prices' => $request->prices,
    		'adress'=>$request->adress,
    		'stage' => $request->stage,
    		'id_number' => $request->id_number,
    		'request_ip' =>$request->getClientIp(),


    	]);
    	if($data){
    		return redirect()->away("http://baidu.com");
    	}
    }
}
